package org.forum.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="vice_topic")
public class ViceTopic implements Serializable{
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(nullable=false,unique=true)
	private Integer viceTopicId;
	
	@Column(nullable=false)
	private Integer publisherId;
	
	@Column(nullable=false)
	private String essay;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(nullable=false)
	private Date addTime;
	
	@ManyToOne(targetEntity=MainTopic.class)
	@JoinColumn(name="mainTopicId", referencedColumnName="mainTopicId", nullable=false)
	private MainTopic mainTopic;
	
	@OneToMany(targetEntity=Picture.class)
	@JoinColumn(name="viceTopicId", referencedColumnName="viceTopicId")
	private Set<Picture> pictures= new HashSet<>();

	public Integer getViceTopicId() {
		return viceTopicId;
	}

	public void setViceTopicId(Integer viceTopicId) {
		this.viceTopicId = viceTopicId;
	}

	public Integer getPublisherId() {
		return publisherId;
	}

	public void setPublisherId(Integer publisherId) {
		this.publisherId = publisherId;
	}

	public String getEssay() {
		return essay;
	}

	public void setEssay(String essay) {
		this.essay = essay;
	}

	public Date getAddTime() {
		return addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}

	public MainTopic getMainTopic() {
		return mainTopic;
	}

	public void setMainTopic(MainTopic mainTopic) {
		this.mainTopic = mainTopic;
	}

	public Set<Picture> getPictures() {
		return pictures;
	}

	public void setPictures(Set<Picture> pictures) {
		this.pictures = pictures;
	}

	
}
